﻿package  
{
	import org.flixel.FlxG;
	
	public class Delay
	{
		private var _delay:Number;
		private var _elapsed_time:Number;
		
		public function Delay(seconds:Number)
		{
			setDelayLength(seconds);
			reset();
		}
		
		public function setDelayLength(seconds:Number):void
		{
			this._delay = seconds;
		}
		
		public function reset():void
		{
			_elapsed_time = 0;
		}
		
		public function hasPassed():Boolean
		{
			update();
			if (_elapsed_time >= _delay) return true;
			return false;
		}
		
		public function update():void
		{
			_elapsed_time += FlxG.elapsed;
		}	
	}
}